package yangcheng;

public class main {
    public static void main(String[] args) {
        Shape circle=new Circle("圆形",4);
        Shape rectangle=new Rectangle("长方形",3,4);
        Shape a = new Triangle("三角形？",3,6,15);
        Shape b = new Triangle("三角形",3,6,8);
        Shape square = new Square("正方形",5);

        Shape[] shapes = new Shape[]{circle,rectangle,a,b,square};



        for (Shape shape : shapes){
            if(shape instanceof Triangle){
                Triangle triangle = (Triangle) shape;
                if(!triangle.isRightTriangle()){
                    continue;
                }
            }
            shape.displayInfo();
            System.out.printf("这个%s的周长是：%.2f\n",shape.getName(),shape.calculatePerimeter());
            System.out.printf("这个%s的面积是：%.2f\n",shape.getName(),shape.calculateArea());
            System.out.println();
        }
    }
}
